<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
</head>
<body>
<script>
    const p = new Promise((resolve,reject)=>{
        // promise变为resolved成功状态
        // resolve(1)
        // promise变为rejected失败状态
        // reject(2)
        // 抛出异常 promise变为rejected失败状态 reason为抛出的error
        // throw new Error('出错了')
        throw 3
    })
    p.then(
        value => {},
        reason => {console.log('reason',reason)}
    )
    p.then(
        value => {},
        reason => {console.log('reason2',reason)}
    )
</script>
</body>
</html>
